package com.springboot.cloud.demos.ribbon.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.form.MessageForm;
import com.springboot.cloud.demos.entity.form.MessageQueryForm;
import com.springboot.cloud.demos.entity.form.UnitForm;
import com.springboot.cloud.demos.entity.param.MessageQueryParam;
import com.springboot.cloud.demos.entity.po.Message;
import com.springboot.cloud.demos.ribbon.service.MessageService;
import com.springboot.cloud.demos.ribbon.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MessageController {

    @Autowired
    private MessageService messageService;

    @GetMapping("/message/{id}")
    public Result get(@PathVariable(value = "id") String id) {
        return messageService.get(id);
    }

    @PostMapping("/message")
    public<Message> Result save(@RequestBody MessageForm form) {
        return messageService.save(form);
    }

    @PostMapping("/message/list")
    public Result list(@RequestBody MessageQueryForm param) {
        return messageService.list(param);
    }
    @PostMapping("/message/count")
    public Result count(@RequestBody MessageQueryForm param) {
        return messageService.count(param);
    }
    @PutMapping(value = "/message")
    public Result update(@RequestBody Message messageForm) {
        return messageService.update(messageForm);
    }
}
